/**
 * Created with IntelliJ IDEA.
 * Description:
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2023-05-22  19:55
 */
class Animal {
    public String name;
    public int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void eat() {
        System.out.println(name+" 正在吃饭！");
    }
}
class Dog extends Animal {
    public Dog(String name, int age) {
        super(name, age);
    }
    public void wangWang() {
        System.out.println(name + "正在汪汪叫！");
    }
}
class Cat extends Animal {
    public Cat(String name, int age) {
        super(name, age);
    }
    public void miaoMiao() {
        System.out.println(name + "正在喵喵叫！");
    }
}
public class Test {
    public static void main(String[] args) {
        Dog dog = new Dog("旺财",10);
        dog.eat();
        dog.wangWang();
        System.out.println("=============");
        Cat cat = new Cat("小白",15);
        cat.eat();
        cat.miaoMiao();
        System.out.println("============");
        Animal animal = new Animal("动物",100);
        animal.eat();
        System.out.println("===========");
        //向上转型
        Animal animal1 = new Dog("小黄",89);
        animal1.eat();
    }
}
